package com.lixumin.user.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.lixumin.user.dao.EmploeeMapper;
import com.lixumin.user.entity.Department;
import com.lixumin.user.entity.Emploee;

@Service("emploeeServiceImpl")
@Transactional(rollbackFor=RuntimeException.class,propagation=Propagation.REQUIRED)
//当方法只有一个执行事件时可以不用显式打@Transactional标签，但是如果一个service方法有多个执行事件时就要显式写出来
public class EmploeeServiceImpl implements EmploeeService {
	@Autowired
	EmploeeMapper mapper;
	@Autowired
	DepartmentService department;
	
	public int createEmploee(Emploee e) {
		
		mapper.insertSelective(e);
		
		Department d=new Department();
		d.setDname("营销部");
		d.setEdeptno(32);
		department.createdDepartment(d);
		return 0;
	}
	

}
